<template>
    <div class="cl6">
        <div class="main">
            <div class="m-t m-ts">
                <div class="m-t-i">序号</div>
                <div class="m-t-i">单位</div>
                <div class="m-t-its">
                    <div class="m-t-it">110警情</div>
                    <div class="m-t-ib">
                        <div class="m-t-i">起数</div>
                        <div class="m-t-i">同比</div>
                    </div>
                </div>
                <div class="m-t-its">
                    <div class="m-t-it">电信(网络)诈骗</div>
                    <div class="m-t-ib">
                        <div class="m-t-i">起数</div>
                        <div class="m-t-i">同比</div>
                    </div>
                </div>
                <div class="m-t-its">
                    <div class="m-t-it">全口径亡人交通事故</div>
                    <div class="m-t-ib">
                        <div class="m-t-i">起数</div>
                        <div class="m-t-i">同比</div>
                    </div>
                </div>
                <div class="m-t-its">
                    <div class="m-t-it">火灾事故</div>
                    <div class="m-t-ib">
                        <div class="m-t-i">起数</div>
                        <div class="m-t-i">同比</div>
                    </div>
                </div>
                <div class="m-t-its">
                    <div class="m-t-it">人民调解</div>
                    <div class="m-t-ib">
                        <div class="m-t-i">排查</div>
                        <div class="m-t-i">化解</div>
                    </div>
                </div>
            </div>
            <div class="m-m">
                <div class="m-t" v-for="(i, o) in mainData" :key="o">
                    <div class="m-t-is">{{ o + 1 }}</div>
                    <div class="m-t-is" v-for="(n, m) in i" :key="m">{{ `${n}${(m == 2 || m == 4 || m == 6 || m == 8) ?
                        '%' : ''}` }} </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    props: ['infoData', 'posItem', 'yearItem', 'monthItem'],
    data() {
        return {
            mainData: []
        }
    },
    watch: {
        posItem: function (infoData) {
            this.mainDataInit();
        },
        yearItem: function (infoData) {
            this.mainDataInit();
        },
        monthItem: function (infoData) {
            this.mainDataInit();
        },
    },
    mounted() {
        this.mainDataInit();
    },
    methods: {
        mainDataInit() {
            this.mainData = [];
            this.infoData[17].map((i, o) => {
                this.mainData.push([i[0], ...JSON.parse(i[this.yearItem])[this.monthItem - 1]])
            })
        }
    }
}
</script>

<style lang="scss" scoped>
.cl6 {
    width: 520px;
    height: 390px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;

    &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 520px;
        height: 390px;
        z-index: 1;
        background-image: url('../../assets/denglukuang.png');
        background-repeat: no-repeat;
        background-size: 100% 100%;
        opacity: .4;
    }

    .main {
        position: relative;
        z-index: 2;
        width: 95%;
        text-shadow: 0 0 8px #000;
        color: #fff;
        margin-top: 10px;

        .m-m {
            max-height: 283px;
            overflow-y: auto;
        }

        .m-t {
            display: flex;
            border-bottom: 1px solid #eeeeee11;
            align-items: center;
            box-sizing: border-box;

            .m-t-i,
            .m-t-is {
                text-align: center;
                height: 40px;
                width: 40.8px;
                display: flex;
                align-items: center;
                justify-content: center;
                border-right: 1px solid #eeeeee11;
                box-sizing: border-box;
            }


            .m-t-is {
                font-size: 12px;
            }
        }

        .m-ts {
            height: 80px;

            .m-t-i {
                height: 80px;
            }

            .m-t-its {
                height: 80px;

                .m-t-it {
                    width: 81.6px;
                    text-align: center;
                    height: 40px;
                    display: flex;
                    align-items: center;
                    border-bottom: 1px solid #eeeeee11;
                    border-right: 1px solid #eeeeee11;
                    justify-content: center;
                    box-sizing: border-box;

                }

                .m-t-ib {
                    width: 81.6px;
                    height: 40px;
                    display: flex;

                    .m-t-i {
                        height: 40px;

                    }
                }
            }

            .m-t-its:last-of-type {
                .m-t-it {
                    border-right-color: #00000000;
                }

                .m-t-ib {
                    .m-t-i:last-of-type {
                        border-right-color: #00000000;

                    }
                }
            }
        }



    }
}
</style>